layui.use(['element', 'layer'], function(){
    var element = layui.element;
    var layer = layui.layer;
    
    //监听折叠
    element.on('collapse(test)', function(data){
      layer.msg('展开状态：'+ data.show);
    });
  });
  layui.use('table', function(){
    var table = layui.table;
    var util = layui.util;
    var id = getId();
    table.render({
      elem: '#repair_table2'
      ,url:head+'/other/refuseList?operationId='+id+'&type=1'
      ,toolbar: '#toolbarDemo'
      ,title: '用户数据表'
      ,request: {
        pageName: 'pageNum' //页码的参数名称，默认：page
        ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
      }
      ,cols: [[ 
        {field:'applicantName', title:'申报人', width:'13%'}
        ,{field:'repairAddr', title:'维修地点', width:'10%'}
        ,{field:'addTime', title:'申报时间', width:150, templet:function(d){return util.toDateString(d.ctime*1000,"yyyy-MM-dd HH:mm")}}
        ,{field:'questionMsg', title:'信息',width:'30%', maxlength:'20'}
        ,{field:'mName', title:'操作管理员',width:'15%'}
        ,{field:'operationMsg', title:'拒绝理由',width:'30%'}
        ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:'10%'}
      ]]
      ,page: true
    });
    
    
    //监听行工具事件
    table.on('tool(test2)', function(obj){
      var data = obj.data;
      //console.log(obj)
      if(obj.event === 'refuse'){
        layer.confirm('是否确定决绝报修', function(index){
          obj.del();
          layer.close(index);
          //操作...
        });
      } else if(obj.event === 'detail'){
        // alert(data.id);
        // alert(data.studentiden);
        //弹出层
        layer.open({
          type: 2, 
          title:'详细信息',
          area: ['84%','86%'],
          offset:['5%','8%'],
          scrollbar: true,
          content: '../repair/repair_refuse_other_item.html?id='+data.id,//这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
          success: function(layero,index){
          
          }
        }); 
  
      }
    });
  });
  